import { User } from "@/types/store"
import { UserAction } from "@/types/store"
const initialValue: User = {
  id: '',
  name: '',
  photo: '',
  art_count: 0,
  follow_count: 0,
  fans_count: 0,
  like_count: 0,
  userProfile: {
    id: '',
    photo: '',
    name: '',
    mobile: '',
    gender: 0,
    birthday: '',
    intro: ''
  }
}

export default function login(state = initialValue, action: UserAction) {
  switch (action.type) {
    case 'user/info':
      return {
        ...state,
        ...action.payload
      }
    case 'profile/getUserProfile':
      return {
        ...state,
        userProfile: action.payload
      }
    default:
      return state
  }
}